#include <iostream>
#include <opencv2\opencv.hpp>

using namespace std;
using namespace cv;


int main(int argc, char **argv)
{
    //Mat img;
    //img = imread("test.jpg",IMREAD_COLOR);
    //if (img.empty()) {
    //    cout << "error" << endl;
    //    return -1;
    //}

    //Mat img2 = imread("test.jpg", IMREAD_GRAYSCALE);


    VideoCapture video;
    video.open(0);

    if (!video.isOpened()) {
        cout << "error" << endl;
        return -1;
    }

    cout <<"当前帧率" << video.get(CAP_PROP_FPS) << endl;

    while (1) {
        Mat vClip;
        video >> vClip;

        if (vClip.empty()) {
            break;
        }

        imshow("video", vClip);

        uchar c = waitKey(1);

        if (c == 'm') {
            break;
        }
    }



    return 0;

}

